﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Psi.Core.Models
{
    /// <summary>
    /// 文章表
    /// </summary>
    [Table("Article")]
    public class Article : Entity
    {
        public Article()
        {
            var dt = DateTime.Now;
            Status = 1;
            Mod = 1;
            CatId = 1;
            Hits = 0;
            ////Sort = DateHelper.DateTimeToStamp(dt);
            AddTime = dt;
            LastTime = dt;
        }
        public string Title { get; set; }
        public string Content { get; set; }
        /// <summary>
        /// 作者
        /// </summary>
        [MaxLength(20)]
        [Display(Name = "作者")]
        public string Writer { get; set; }
        /// <summary>
        /// 来源
        /// </summary>
        [MaxLength(255)]
        [Display(Name = "来源")]
        public string Source { get; set; }
        /// <summary>
        /// 关键字
        /// </summary>
        [MaxLength(512)]
        [Display(Name = "关键字")]
        public string Keywords { get; set; }
        /// <summary>
        /// 摘要
        /// </summary>
        [MaxLength(1024)]
        [Display(Name = "摘要")]
        public string Description { get; set; }
        /// <summary>
        /// 缩略图
        /// </summary>
        public string Image { get; set; }
        /// <summary>
        /// 分类Id
        /// </summary>
        public int CatId { get; set; }
        /// <summary>
        /// 0无1文章2页面
        /// </summary>
        public int Mod { get; set; }
        /// <summary>
        /// 点击量
        /// </summary>
        [Display(Name = "点击量")]
        public int Hits { get; set; }
        /// <summary>
        /// 排序
        /// <remarks>默认0 越大越靠前</remarks>
        /// </summary>
        public int Sort { get; set; }
        /// <summary>
        /// 状态
        /// <remarks>删除-2 关闭-1 审核/草稿0 发布1</remarks>
        /// </summary>
        public int Status { get; set; }
        public DateTime AddTime { get; set; }
        public DateTime LastTime { get; set; }

        public virtual Category Category { get; set; }
    }
}
